home *** CD-ROM | disk | FTP | other *** search
-
- #define NOCOMM
- #include <windows.h>
- #include <memory.h>
-
- #include "hugearr.h"
-
- /* Copy multiple VB array elements into multiple huge array elements. */
- /* VBM: Declare Function VBHugeSetNum% Lib "hugearr.dll" Alias "VBHugeSetNum" (ByVal Index%, ByVal el&, ByVal nelem%, buffer As Any) */
- int FAR PASCAL
- VBHugeSetNum(int hArray, long element, int nelem, LPBYTE buffer)
- {
- HPBYTE ToBegin;
- HPBYTE ToElem; /* pointer to array element */
- PHUGEDESC pArray; /* pointer to array descriptor */
-
- DecCheckHandle(hArray);
-
- /* point to proper descriptor */
- pArray = (PHUGEDESC) LocalLock(hLocalMem) + hArray;
-
- CheckNotAllocYet(pArray);
- CheckSubscript(pArray, element, element + nelem - 1);
-
- /* calculate pointer to element */
- ToBegin = (HPBYTE) GlobalLock(pArray -> handle);
-
- while (nelem-- > 0)
- {
- ToElem = ToBegin + HugeElementOffset(element, pArray->perseg, pArray->recsize);
-
- /* copy one element of data */
- _fmemcpy(ToElem, buffer, pArray -> recsize);
-
- /* increment pointer to VB array to point to next element. */
- buffer += pArray -> recsize;
- element ++;
- }
-
- GlobalUnlock(pArray -> handle);
- LocalUnlock(hLocalMem);
- return HA_OK;
- }
-